
<form role="form" class="epii" method="post" data-form="1" action="{url member_info add_edit }">
    <div class="form-group">
        <label><span style="color: red">*</span>关系：</label>
        <select class="selectpicker" name="r[relation]"  required>
            {:options,$relation,$info.relation}
        </select>
    </div>
    <div class="form-group">
        <label><span style="color: red">*</span>手机号：</label>
        <input type="text" class="form-control" id="phone" name="r[phone]" value="{? $info.phone}" required
               placeholder="请输入手机号" >
    </div>
    <div class="form-group">
        <label><span style="color: red">*</span>归属家庭组：</label>
        <input type="text" class="form-control" name="r[family_group]" id="family_group" value="{? $info.family_group}" required
               placeholder="" readonly>
    </div>
    <div class="form-group">
        <label><span style="color: red">*</span>姓名：</label>
        <input type="text" class="form-control" name="r[name]" value="{? $info.name}" required
               placeholder="请输入患者名称" >
    </div>
    <div class="form-group">
        <label><span style="color: red">*</span>性别：</label>
        <select class="selectpicker" name="r[sex]" required>
            {:options,$sex,$info.sex}
        </select>
    </div>
    <div class="form-group">
        <label>阳历生日：</label>
        <input type="text" class="form-control" name="r[birth_date]" id="birth_date" value="{? $info.birth_date}"
               placeholder="请输入患者阳历生日">
    </div>
    <div class="form-group">
        <label>阴历生日：</label>
        <input type="text" class="form-control" name="r[lunar_birth]" value="{? $info.lunar_birth}"
               placeholder="请输入患者阴历生日" >
    </div>
    <div class="form-group">
        <label>民族：</label>
        <input type="text" class="form-control" name="r[nation]" value="{? $info.nation}"
               placeholder="请输入民族" >
    </div>
    <div class="form-group">
        <label>身高：</label>
        <input type="text" class="form-control" name="r[height]" value="{? $info.height}"
               placeholder="请输入患者身高(cm)" >
    </div>
    <div class="form-group">
        <label>体重：</label>
        <input type="text" class="form-control" name="r[weight]" value="{? $info.weight}"
               placeholder="请输入患者体重(kg)">
    </div>
    <div class="form-group">
        <label>家庭地址：</label>
        <input type="text" class="form-control" name="r[address]" value="{? $info.address}"
               placeholder="请输入家庭地址" >
    </div>
    <div class="form-group">
        <label>学历：</label>
        <select class="selectpicker" name="r[education]" >
            {:options,$education,$info.education}
        </select>
    </div>
    <div class="form-group">
        <label>工作性质：</label>
        <input type="text" class="form-control" name="r[work]" value="{? $info.work}"
               placeholder="请输入工作性质" >
    </div>
    <div class="form-group">
        <label>家庭排行：</label>
        <input type="text" class="form-control" name="r[family_rank]" value="{? $info.family_rank}"
               placeholder="请输入家庭排行" >
    </div>
    <div class="form-group">
        <label>婚育情况：</label>
        <input type="text" class="form-control" name="r[marriage_childbirth]" value="{? $info.marriage_childbirth}"
               placeholder="请输入婚育情况" >
    </div>
    <input type="hidden" name="id" value="{$id?0}">
    <div class="form-footer">
        <button type="submit" class="btn btn-primary">提交</button>
    </div>
</form>
<script src="{$laydate}/laydate.js"></script>
<script>
    window.onEpiiInit(function () {
        $('#phone').change(function () {
            let phone=$(this).val();
            $('#family_group').val(' ');
            if (phone.length==11){
                var loading=layer.load(1);
                $.ajax({
                    url: '?app=member_info@getFamily&phone='+phone,
                    type: 'get',
                    dataType:'json',
                    success: function(res) {
                        console.log(res)
                        if(res.code==1){
                            $('#family_group').val(res.data.real_name+'-'+res.data.phone);
                            // $('#real_name').attr('readonly',true);
                        }else{
                            layer.alert(res.msg,{icon:2})
                        }
                        layer.close(loading)
                    }
                });
                // layer.close(loading)
            }
        });

        //
        laydate.render({
            elem: '#birth_date',
            trigger: 'click',
            format: 'yyyy-MM-dd',

        });

    });
</script>
